-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support initializationOptions
to configure the server
#459
Support initializationOptions
to configure the server
#459
Conversation
from pylsp import IS_WIN | ||
|
||
|
||
INITIALIZATION_OPTIONS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this as an example as this is a real world example for when to override confs
@@ -98,6 +98,10 @@ def __init__(self, root_uri, init_opts, process_id, capabilities): | |||
self._plugin_settings, plugin_conf | |||
) | |||
|
|||
self._plugin_settings = _utils.merge_dicts( | |||
self._plugin_settings, self._init_opts.get("pylsp", {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Language servers typically don't scope initialization settings to server name because, unlike the workspace settings, those are specific to the server itself and don't have any chance of conflicting with other settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy to address this, but it seems that there is lack of consensus on whether initializationOptions
should be used for server configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pylsp
is the options namespace used for this server, so I'm fine with using it here.
Some context:
|
@krassowski thanks for the context. I have a clear use case in mind: enabling rope_autoimport without a config file. From the code and #195 I see that I feel the discussion around As more and more language servers will run in cloud VMs and not on a local machine, these servers need to be configurable dynamically.
|
initializationOptions
to configure the server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one tiny suggestion for you @tkrabel-db.
@ccordoba12 thanks for supporting this feature! I addressed you comment and also refactored the unit test to use the new test util functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, thanks @tkrabel-db!
What changes are proposed in this pull request?
Fixes #195.
The language server supports passing
initializationOptions
with theinitialize
message, but actually doesn't do anything with it. I think this was an oversight. This PR supports overriding configuration settings using theinitializationOptions
field.How is this tested?